Skip to content

Add OpenTelemetry instrumentation extension library for Papst.EventStore#265

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-opentelemetry-extension
Draft

Add OpenTelemetry instrumentation extension library for Papst.EventStore#265
Copilot wants to merge 2 commits intomainfrom
copilot/add-opentelemetry-extension

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

Adds Papst.EventStore.OpenTelemetry — a new extension library that instruments all EventStore and EventStream operations with System.Diagnostics.ActivitySource-based tracing, compatible with any OpenTelemetry collector without requiring the OTel SDK as a dependency.

Design

  • Decorator pattern — three internal decorators wrap IEventStore, IEventStream, and IEventStoreTransactionAppender, adding activities around every operation with relevant tags (event_store.stream_id, event_store.event_type, event_store.event_id, etc.) and recording exceptions as ActivityStatusCode.Error
  • Works with all store implementations — InMemory, MongoDB, CosmosDB, EF Core, FileSystem; call AddEventStoreInstrumentation() after registering any store

Usage

services.AddInMemoryEventStore()
        .AddEventRegistrationTypeProvider()
        .AddEventStoreInstrumentation(); // wraps the registered IEventStore transparently

// Wire up in your OTel pipeline:
tracerProviderBuilder.AddSource(EventStoreActivitySource.SourceName); // "Papst.EventStore"

Activity coverage

Operation Activity name
IEventStore.GetAsync EventStore.Get
IEventStore.CreateAsync EventStore.Create
IEventStream.AppendAsync EventStream.Append
IEventStream.AppendSnapshotAsync EventStream.AppendSnapshot
IEventStream.ListAsync / ListDescendingAsync EventStream.List / EventStream.ListDescending
IEventStream.CreateTransactionalBatchAsync EventStream.CreateTransactionalBatch
IEventStream.UpdateStreamMetaData EventStream.UpdateMetaData
IEventStoreTransactionAppender.Add EventStore.TransactionAppender.Add
IEventStoreTransactionAppender.CommitAsync EventStore.TransactionAppender.Commit
Original prompt

This section details on the original issue you should resolve

<issue_title>Open Telemetry Compatability</issue_title>
<issue_description>Add an Extension Library that extends the EventStore (in all implementations) to produce OpenTelemetry compatible events</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: MPapst <16494676+MPapst@users.noreply.github.com>
Copilot AI changed the title [WIP] Add extension library for OpenTelemetry compatibility Add OpenTelemetry instrumentation extension library for Papst.EventStore Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open Telemetry Compatability

2 participants